.class abstract Les/ve0;
.super Ljava/lang/Object;
.source "OBEXSessionBase.java"

# interfaces
.implements Les/lp0;


# instance fields
.field protected a:Z

.field private b:Les/pp0;

.field private c:Ljava/io/InputStream;

.field private d:Ljava/io/OutputStream;

.field protected e:J

.field protected f:I

.field protected g:Les/rp0;

.field protected h:Les/ke0;

.field protected i:I

.field protected j:I

.field private k:Ljava/util/Vector;

.field protected l:Z


# direct methods
.method public constructor <init>(Les/pp0;Les/ke0;)V
    .locals 4
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    const-string v0, "close error"

    .line 1
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const/16 v1, 0x4000

    .line 2
    iput v1, p0, Les/ve0;->f:I

    if-eqz p2, :cond_0

    const/4 v1, 0x0

    .line 3
    iput-boolean v1, p0, Les/ve0;->a:Z

    .line 4
    iput-object p1, p0, Les/ve0;->b:Les/pp0;

    .line 5
    iput-object p2, p0, Les/ve0;->h:Les/ke0;

    .line 6
    iget p2, p2, Les/ke0;->c:I

    iput p2, p0, Les/ve0;->f:I

    const-wide/16 v2, -0x1

    .line 7
    iput-wide v2, p0, Les/ve0;->e:J

    .line 8
    iput v1, p0, Les/ve0;->i:I

    .line 9
    iput v1, p0, Les/ve0;->j:I

    .line 10
    :try_start_0
    invoke-interface {p1}, Les/op0;->h()Ljava/io/OutputStream;

    move-result-object p2

    iput-object p2, p0, Les/ve0;->d:Ljava/io/OutputStream;

    .line 11
    invoke-interface {p1}, Les/np0;->a()Ljava/io/InputStream;

    move-result-object p1

    iput-object p1, p0, Les/ve0;->c:Ljava/io/InputStream;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_1
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    goto :goto_1

    :catchall_0
    move-exception p1

    .line 12
    :try_start_1
    invoke-virtual {p0}, Les/ve0;->close()V
    :try_end_1
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_0

    goto :goto_0

    :catch_0
    move-exception p2

    .line 13
    invoke-static {v0, p2}, Les/be0;->b(Ljava/lang/String;Ljava/lang/Throwable;)V

    .line 14
    :goto_0
    throw p1

    .line 15
    :catch_1
    :try_start_2
    invoke-virtual {p0}, Les/ve0;->close()V
    :try_end_2
    .catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_2

    goto :goto_1

    :catch_2
    move-exception p1

    .line 16
    invoke-static {v0, p1}, Les/be0;->b(Ljava/lang/String;Ljava/lang/Throwable;)V

    :goto_1
    return-void

    .line 17
    :cond_0
    new-instance p1, Ljava/lang/NullPointerException;

    const-string p2, "obexConnectionParams is null"

    invoke-direct {p1, p2}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V

    throw p1
.end method

.method static g(Les/tp0;)V
    .locals 0

    .line 1
    invoke-static {p0}, Les/le0;->c(Les/tp0;)V

    return-void
.end method

.method public static k()Les/tp0;
    .locals 1

    .line 1
    invoke-static {}, Les/ve0;->l()Les/le0;

    move-result-object v0

    return-object v0
.end method

.method static l()Les/le0;
    .locals 1

    .line 1
    new-instance v0, Les/le0;

    invoke-direct {v0}, Les/le0;-><init>()V

    return-object v0
.end method


# virtual methods
.method protected a(ILes/le0;)V
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    const/4 v0, 0x0

    .line 1
    invoke-virtual {p0, p1, v0, p2}, Les/ve0;->a(I[BLes/le0;)V

    return-void
.end method

.method protected declared-synchronized a(I[BLes/le0;)V
    .locals 8
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    monitor-enter p0

    const/4 v0, 0x1

    .line 2
    :try_start_0
    iput-boolean v0, p0, Les/ve0;->l:Z

    const/4 v1, 0x3

    .line 3
    iget-wide v2, p0, Les/ve0;->e:J

    const-wide/16 v4, -0x1

    cmp-long v6, v2, v4

    if-eqz v6, :cond_0

    const/16 v1, 0x8

    :cond_0
    if-eqz p2, :cond_1

    .line 4
    array-length v2, p2

    add-int/2addr v1, v2

    :cond_1
    const/4 v2, 0x0

    if-eqz p3, :cond_2

    .line 5
    invoke-static {p3}, Les/le0;->b(Les/tp0;)[B

    move-result-object v2

    .line 6
    array-length v3, v2

    add-int/2addr v1, v3

    .line 7
    :cond_2
    iget v3, p0, Les/ve0;->f:I

    if-gt v1, v3, :cond_8

    .line 8
    iget v3, p0, Les/ve0;->i:I

    add-int/2addr v3, v0

    iput v3, p0, Les/ve0;->i:I

    .line 9
    new-instance v0, Ljava/io/ByteArrayOutputStream;

    invoke-direct {v0}, Ljava/io/ByteArrayOutputStream;-><init>()V

    .line 10
    invoke-static {v0, p1, v1}, Les/le0;->a(Ljava/io/OutputStream;II)V

    if-eqz p2, :cond_3

    .line 11
    invoke-virtual {v0, p2}, Ljava/io/ByteArrayOutputStream;->write([B)V

    .line 12
    :cond_3
    iget-wide v6, p0, Les/ve0;->e:J

    cmp-long p2, v6, v4

    if-eqz p2, :cond_4

    const/16 p2, 0xcb

    .line 13
    iget-wide v3, p0, Les/ve0;->e:J

    invoke-static {v0, p2, v3, v4}, Les/le0;->a(Ljava/io/OutputStream;IJ)V

    :cond_4
    if-eqz v2, :cond_5

    .line 14
    invoke-virtual {v0, v2}, Ljava/io/ByteArrayOutputStream;->write([B)V

    .line 15
    :cond_5
    new-instance p2, Ljava/lang/StringBuilder;

    invoke-direct {p2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "obex send ("

    invoke-virtual {p2, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget v2, p0, Les/ve0;->i:I

    invoke-virtual {p2, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    const-string v2, ")"

    invoke-virtual {p2, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p2

    .line 16
    invoke-static {p1}, Les/xe0;->c(I)Ljava/lang/String;

    move-result-object v2

    int-to-long v3, p1

    .line 17
    invoke-static {p2, v2, v3, v4}, Les/be0;->a(Ljava/lang/String;Ljava/lang/String;J)V

    .line 18
    iget-object p1, p0, Les/ve0;->d:Ljava/io/OutputStream;

    invoke-virtual {v0}, Ljava/io/ByteArrayOutputStream;->toByteArray()[B

    move-result-object p2

    invoke-virtual {p1, p2}, Ljava/io/OutputStream;->write([B)V

    .line 19
    iget-object p1, p0, Les/ve0;->d:Ljava/io/OutputStream;

    invoke-virtual {p1}, Ljava/io/OutputStream;->flush()V

    .line 20
    new-instance p1, Ljava/lang/StringBuilder;

    invoke-direct {p1}, Ljava/lang/StringBuilder;-><init>()V

    const-string p2, "obex sent ("

    invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget p2, p0, Les/ve0;->i:I

    invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    const-string p2, ") len"

    invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    int-to-long v0, v1

    invoke-static {p1, v0, v1}, Les/be0;->a(Ljava/lang/String;J)V

    if-eqz p3, :cond_7

    .line 21
    invoke-virtual {p3}, Les/le0;->e()Z

    move-result p1

    if-eqz p1, :cond_7

    .line 22
    iget-object p1, p0, Les/ve0;->k:Ljava/util/Vector;

    if-nez p1, :cond_6

    .line 23
    new-instance p1, Ljava/util/Vector;

    invoke-direct {p1}, Ljava/util/Vector;-><init>()V

    iput-object p1, p0, Les/ve0;->k:Ljava/util/Vector;

    .line 24
    :cond_6
    invoke-virtual {p3}, Les/le0;->a()Ljava/util/Enumeration;

    move-result-object p1

    .line 25
    :goto_0
    invoke-interface {p1}, Ljava/util/Enumeration;->hasMoreElements()Z

    move-result p2

    if-eqz p2, :cond_7

    .line 26
    invoke-interface {p1}, Ljava/util/Enumeration;->nextElement()Ljava/lang/Object;

    move-result-object p2

    check-cast p2, [B

    .line 27
    new-instance p3, Les/fe0$a;

    invoke-direct {p3, p2}, Les/fe0$a;-><init>([B)V

    .line 28
    iget-object p2, p0, Les/ve0;->k:Ljava/util/Vector;

    invoke-virtual {p2, p3}, Ljava/util/Vector;->addElement(Ljava/lang/Object;)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    goto :goto_0

    .line 29
    :cond_7
    monitor-exit p0

    return-void

    .line 30
    :cond_8
    :try_start_1
    new-instance p1, Ljava/io/IOException;

    new-instance p2, Ljava/lang/StringBuilder;

    invoke-direct {p2}, Ljava/lang/StringBuilder;-><init>()V

    const-string p3, "Can\'t sent more data than in MTU, len="

    invoke-virtual {p2, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p2, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    const-string p3, ", mtu="

    invoke-virtual {p2, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget p3, p0, Les/ve0;->f:I

    invoke-virtual {p2, p3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    invoke-virtual {p2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p2

    invoke-direct {p1, p2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw p1
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    :catchall_0
    move-exception p1

    monitor-exit p0

    goto :goto_2

    :goto_1
    throw p1

    :goto_2
    goto :goto_1
.end method

.method a(Les/le0;Les/le0;)V
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 44
    invoke-virtual {p1}, Les/le0;->e()Z

    move-result v0

    if-eqz v0, :cond_1

    .line 45
    iget-object v0, p0, Les/ve0;->g:Les/rp0;

    if-eqz v0, :cond_0

    .line 46
    invoke-static {p1, p2, v0}, Les/fe0;->a(Les/le0;Les/le0;Les/rp0;)V

    goto :goto_0

    .line 47
    :cond_0
    new-instance p1, Ljava/io/IOException;

    const-string p2, "Authenticator required for authentication"

    invoke-direct {p1, p2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw p1

    :cond_1
    :goto_0
    return-void
.end method

.method a(Les/le0;Les/wp0;)Z
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 31
    invoke-virtual {p1}, Les/le0;->f()Z

    move-result v0

    if-eqz v0, :cond_3

    .line 32
    iget-object v0, p0, Les/ve0;->g:Les/rp0;

    if-eqz v0, :cond_2

    .line 33
    iget-object v0, p0, Les/ve0;->k:Ljava/util/Vector;

    if-eqz v0, :cond_1

    .line 34
    invoke-virtual {v0}, Ljava/util/Vector;->size()I

    move-result v0

    if-eqz v0, :cond_1

    .line 35
    :try_start_0
    iget-object v0, p0, Les/ve0;->g:Les/rp0;

    iget-object v1, p0, Les/ve0;->k:Ljava/util/Vector;

    .line 36
    invoke-static {p1, v0, p2, v1}, Les/fe0;->a(Les/le0;Les/rp0;Les/wp0;Ljava/util/Vector;)Z

    move-result p1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    if-eqz p1, :cond_0

    .line 37
    iget-object p2, p0, Les/ve0;->k:Ljava/util/Vector;

    if-eqz p2, :cond_0

    .line 38
    invoke-virtual {p2}, Ljava/util/Vector;->removeAllElements()V

    :cond_0
    return p1

    :catchall_0
    move-exception p1

    .line 39
    throw p1

    .line 40
    :cond_1
    new-instance p1, Ljava/io/IOException;

    const-string p2, "Authentication challenges had not been sent"

    invoke-direct {p1, p2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw p1

    .line 41
    :cond_2
    new-instance p1, Ljava/io/IOException;

    const-string p2, "Authenticator required for authentication"

    invoke-direct {p1, p2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw p1

    .line 42
    :cond_3
    iget-object p1, p0, Les/ve0;->k:Ljava/util/Vector;

    if-eqz p1, :cond_5

    invoke-virtual {p1}, Ljava/util/Vector;->size()I

    move-result p1

    if-gtz p1, :cond_4

    goto :goto_0

    .line 43
    :cond_4
    new-instance p1, Ljava/io/IOException;

    const-string p2, "Authentication response is missing"

    invoke-direct {p1, p2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw p1

    :cond_5
    :goto_0
    const/4 p1, 0x1

    return p1
.end method

.method b(Les/le0;Les/le0;)V
    .locals 0
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    if-eqz p1, :cond_1

    .line 1
    invoke-virtual {p1}, Les/le0;->e()Z

    move-result p1

    if-eqz p1, :cond_1

    .line 2
    invoke-virtual {p2}, Les/le0;->f()Z

    move-result p1

    if-eqz p1, :cond_0

    goto :goto_0

    .line 3
    :cond_0
    new-instance p1, Ljava/io/IOException;

    const-string p2, "Authentication response is missing"

    invoke-direct {p1, p2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw p1

    :cond_1
    :goto_0
    const/4 p1, 0x0

    .line 4
    invoke-virtual {p0, p2, p1}, Les/ve0;->a(Les/le0;Les/wp0;)Z

    return-void
.end method

.method public close()V
    .locals 3
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 1
    iget-object v0, p0, Les/ve0;->b:Les/pp0;

    const/4 v1, 0x0

    .line 2
    iput-object v1, p0, Les/ve0;->b:Les/pp0;

    .line 3
    :try_start_0
    iget-object v2, p0, Les/ve0;->c:Ljava/io/InputStream;

    if-eqz v2, :cond_0

    .line 4
    iget-object v2, p0, Les/ve0;->c:Ljava/io/InputStream;

    invoke-virtual {v2}, Ljava/io/InputStream;->close()V

    .line 5
    iput-object v1, p0, Les/ve0;->c:Ljava/io/InputStream;

    .line 6
    :cond_0
    iget-object v2, p0, Les/ve0;->d:Ljava/io/OutputStream;

    if-eqz v2, :cond_1

    .line 7
    iget-object v2, p0, Les/ve0;->d:Ljava/io/OutputStream;

    invoke-virtual {v2}, Ljava/io/OutputStream;->close()V

    .line 8
    iput-object v1, p0, Les/ve0;->d:Ljava/io/OutputStream;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    :cond_1
    if-eqz v0, :cond_2

    .line 9
    invoke-interface {v0}, Les/lp0;->close()V

    :cond_2
    return-void

    :catchall_0
    move-exception v1

    if-eqz v0, :cond_3

    invoke-interface {v0}, Les/lp0;->close()V

    .line 10
    :cond_3
    throw v1
.end method

.method public i()Z
    .locals 1

    .line 1
    iget-object v0, p0, Les/ve0;->b:Les/pp0;

    if-nez v0, :cond_0

    const/4 v0, 0x1

    return v0

    :cond_0
    const/4 v0, 0x0

    return v0
.end method

.method protected declared-synchronized j()[B
    .locals 8
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    monitor-enter p0

    .line 1
    :try_start_0
    iget-boolean v0, p0, Les/ve0;->l:Z

    if-eqz v0, :cond_3

    const/4 v0, 0x0

    .line 2
    iput-boolean v0, p0, Les/ve0;->l:Z

    const/4 v1, 0x3

    new-array v2, v1, [B

    .line 3
    iget-object v3, p0, Les/ve0;->c:Ljava/io/InputStream;

    iget-object v4, p0, Les/ve0;->h:Les/ke0;

    invoke-static {v3, v4, v2}, Les/xe0;->a(Ljava/io/InputStream;Les/ke0;[B)V

    .line 4
    iget v3, p0, Les/ve0;->j:I

    const/4 v4, 0x1

    add-int/2addr v3, v4

    iput v3, p0, Les/ve0;->j:I

    .line 5
    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    const-string v5, "obex received ("

    invoke-virtual {v3, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget v5, p0, Les/ve0;->j:I

    invoke-virtual {v3, v5}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    const-string v5, ")"

    invoke-virtual {v3, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    aget-byte v5, v2, v0

    .line 6
    invoke-static {v5}, Les/xe0;->a(B)Ljava/lang/String;

    move-result-object v5

    aget-byte v6, v2, v0

    and-int/lit16 v6, v6, 0xff

    int-to-long v6, v6

    .line 7
    invoke-static {v3, v5, v6, v7}, Les/be0;->a(Ljava/lang/String;Ljava/lang/String;J)V

    .line 8
    aget-byte v3, v2, v4

    const/4 v4, 0x2

    aget-byte v4, v2, v4

    invoke-static {v3, v4}, Les/xe0;->a(BB)I

    move-result v3
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    if-ne v3, v1, :cond_0

    .line 9
    monitor-exit p0

    return-object v2

    :cond_0
    if-lt v3, v1, :cond_2

    const v4, 0xffff

    if-gt v3, v4, :cond_2

    .line 10
    :try_start_1
    new-array v4, v3, [B

    .line 11
    invoke-static {v2, v0, v4, v0, v1}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V

    .line 12
    iget-object v0, p0, Les/ve0;->c:Ljava/io/InputStream;

    iget-object v2, p0, Les/ve0;->h:Les/ke0;

    sub-int/2addr v3, v1

    invoke-static {v0, v2, v4, v1, v3}, Les/xe0;->a(Ljava/io/InputStream;Les/ke0;[BII)V

    .line 13
    iget-object v0, p0, Les/ve0;->c:Ljava/io/InputStream;

    invoke-virtual {v0}, Ljava/io/InputStream;->available()I

    move-result v0

    if-lez v0, :cond_1

    const-string v0, "has more data after read"

    .line 14
    iget-object v1, p0, Les/ve0;->c:Ljava/io/InputStream;

    invoke-virtual {v1}, Ljava/io/InputStream;->available()I

    move-result v1

    int-to-long v1, v1

    invoke-static {v0, v1, v2}, Les/be0;->a(Ljava/lang/String;J)V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    .line 15
    :cond_1
    monitor-exit p0

    return-object v4

    .line 16
    :cond_2
    :try_start_2
    new-instance v0, Ljava/io/IOException;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Invalid packet length "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1, v3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 17
    :cond_3
    new-instance v0, Ljava/io/IOException;

    const-string v1, "Read packet out of order"

    invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw v0
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method
